<div class="form-group">
	<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">开启阶梯团</label>
	<div class="col-xs-12 col-sm-8">
		<label class="radio radio-inline">
			<input type="radio" name="goods[group_level_status]" value="1" {if intval($goods['group_level_status']) ==1}checked="checked"{/if} onclick="$('#level').hide();"> 不开启
		</label>
		<label class="radio radio-inline">
			<input type="radio" name="goods[group_level_status]" value="2" {if intval($goods['group_level_status']) ==2}checked="checked"{/if} onclick="$('#level').show();"> 开启
		</label>
		<div class="col-sm-9 col-xs-12">
		<span class="help-block">启用阶梯团后，商品规格将失效，商品的价格及库存以阶梯团为准</span>
	</div>
	</div>
</div>

<div class="form-group" id="level" {if $goods['group_level_status']!=2}style="display: none;"{/if}>
	<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>阶梯</label>
	<div class="col-sm-9 col-xs-12">
		<div class="panel-body table-responsive" style="padding:0px;">
			<table class="table table-hover">
				<thead>
				<tr>
					<th style='width:50px;'></th>
					<th>几人</th>
					<th>团购价</th>
				</tr>
				</thead>
				<tbody id="param-items-level">
					{loop $param_level $item}
					<tr>
						<td>
							<a href="javascript:;" class="fa fa-move" title="拖动调整此显示顺序"><i class="fa fa-arrows"></i></a>&nbsp;
							<a href="javascript:;" onclick="deleteParam_level(this)" style="margin-top:10px;" title="删除"><i class='fa fa-remove'></i></a>
						</td>
						<td>
							<input name="param_groupnum[]" type="text" class="form-control param_title" value="{$item['groupnum']}"/>
						</td>
						<td><input name="param_groupprice[]" type="text" class="form-control param_value" value="{$item['groupprice']}"/></td>
					</tr>
					{/loop}
				</tbody>
				
				<tbody>
					<tr>
						<td colspan="3">
							<a href="javascript:;" id='add-param' onclick="addParam_level()" style="margin-top:10px;"  title="添加阶梯">添加阶梯 <i class='fa fa-plus'></i></a>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</div>
	<script language="javascript">
	$(function(){
		$("#param-items-level").sortable({handle:'.fa-move'});
		$("#chkoption").click(function(){
			var obj =$(this);
			if(obj.get(0).checked){
				$("#tboption").show();
				$(".trp").hide();
			}
			else{
				$("#tboption").hide();
				$(".trp").show();
			}
		});
	})
	function addParam_level() {
		var url = "{php echo web_url('goods/param_level')}";
		$.ajax({
			"url": url ,
			success:function(data){
				$('#param-items-level').append(data);
			}
		});
		return;
	}
	function deleteParam_level(o) {
		$(o).parent().parent().remove();
	}
</script>